#ifndef _UDT_STRUCT_INC
#define _UDT_STRUCT_INC

#define MAX_INTERVAL 8000
#define MAX_POINTS (MAX_INTERVAL*2)
#define MAX_LABEL 20
#define MAX_ITEM 7000
#define MAX_ATTRIB 50

#define STOP_CRITERA 0.1


typedef struct _UDTInterval
{
	double low;
	double high;
	double density;
	int label;
	} UDTInterval;

typedef struct _UDTIntervalSet
{
	int interval_count;
	int label_count;
	UDTInterval intervals[MAX_INTERVAL];	
	} UDTIntervalSet;


typedef struct _UDTPoint
{
	double value;
	UDTInterval* pInt;
	int flagLeft;
	}	UDTPoint;

typedef struct _UDTPointSet
{	
	int point_count;
	UDTIntervalSet* pIntSet;
	UDTPoint points[MAX_POINTS];
	} UDTPointSet;


typedef struct _UDTDataItem
{
	int label;
	double attrib[MAX_ATTRIB][3];
} UDTDataItem;
	

typedef struct _UDTDataLinkSet
{
	int linkCount;
    int labelCount;
    int attribCount;
	UDTDataItem *items[MAX_ITEM];
} UDTDataLinkSet;
	
struct _UDTTreeObject;
	
typedef struct _UDTTreeObject
{
	int testAttrib;
	double splitPoint;
	struct _UDTTreeObject *pLeft, *pRight;
    double *labelProb;
} UDTTreeObject, *UDTTreeLink;

void udt_freeTree(UDTTreeLink pRoot);

#endif // _UDT_STRUCT_INC
